CC            = gcc
BUILT_DIR	  = built
TARGET        = app

# head file path
INCLUDE       = -I ./src \

# sources files
SOURCES       = src/json.c \
				main.c \
				
OBJS          = $(patsubst %.c, $(BUILT_DIR)/%.o, $(SOURCES))
TAR_PATH	  = $(BUILT_DIR)/app

# link
${TAR_PATH}:$(OBJS)
	$(CC) $(OBJS) -o $(TAR_PATH) -lm -lpthread

# compile
$(BUILT_DIR)/%.o:%.c
	$(shell mkdir -p $(dir $@))
	$(CC) $(INCLUDE) -c $< -o $@
	
.PHONY:clean
clean:
	@echo "remove app and objs files ..."
	$(shell rm $(BUILT_DIR)/* -rf)
